package com.spring.gll.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/login")
public class LoginController {
    @RequestMapping("/view")
    public String view(){
        return "login";
    }
    @RequestMapping("/login")
    public String login(@RequestParam("name") String name, @RequestParam("pwd") String pwd,HttpServletRequest request){
        request.getSession().setAttribute("name","f ");
        if(name.equals("qqq")&&pwd.equals("123")){
            return "Success";
        }
        return "login";
    }
    @RequestMapping("/exit")
    public String exit(HttpServletRequest request){
        request.getSession().removeAttribute("name");
        return "login";
    }
}
